<template>
  <div>
    <van-popup
      :close-on-click-overlay="false"
      v-model="skuShow"
      position="bottom"
      closeable
      @click-close-icon="close"
      :style="{ height: '40%' }"
    >
      <div class="top">
        <van-image width="1rem" height="1rem" :src="info.list_pic_url" />
        <div class="info">
          <p>价格:{{ $global.toYuan(info.retail_price) }}</p>
          <p>库存:{{ info.goods_number }}</p>
        </div>
      </div>
      <div class="bottom">
        <h2>数量:</h2>
        <van-stepper
          v-model="num"
          @change="changeFn"
          :max="info.goods_number"
        />
      </div>
    </van-popup>
  </div>
</template>

<script>
export default {
  props: ['skuShow', 'info'],
  data () {
    return {
      num: 1
    }
  },
  methods: {
    close () {
      this.$emit('close')
    },
    changeFn (v) {
      this.$emit('changeFn', v)
    }
  }
}
</script>

<style scoped lang='less'>
.top {
  width: 100%;
  height: 40%;
  padding-top: 0.4rem;
  display: flex;
  .van-image {
    margin-left: 0.2rem;
    margin-top: 0rem;
  }
  .info {
    margin-top: 0.3rem;
    flex: 1;
    padding-left: 0.1rem;
    display: flex;
    justify-content: space-around;
    flex-direction: column;
    p {
      height: 50%;
      line-height: 50%;
      font-size: 0.16rem;
    }
  }
}
.bottom {
  width: 100%;
  height: 40%;
  padding-left: 0.1rem;
  h2 {
    font-size: 0.18rem;
    font-weight: 600;
    height: 0.2rem;
    line-height: 0.2rem;
    padding-bottom: 0.15rem;
  }
}
</style>
